#ifndef QPROPERTYDELEGATE_H
#define QPROPERTYDELEGATE_H

#include "QtPropertyExplorerLib.h"

#include <QStyledItemDelegate>

namespace QPE {

class QTPROPERTYEXPLORER_DLL_EXPORT QPropertyDelegate : public QStyledItemDelegate
{
	Q_OBJECT
public:
	explicit QPropertyDelegate(QObject *parent = 0);
	virtual ~QPropertyDelegate();

	//! Creates the editor widget
	virtual QWidget* createEditor (QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const;

	//! Sets the index data to the editor
	virtual void setEditorData (QWidget * editor, const QModelIndex & index) const;

	//! Updates the index data
	virtual void setModelData (QWidget * editor, QAbstractItemModel * model, const QModelIndex & index) const;

	//! Returns the size hint
	virtual QSize sizeHint (const QStyleOptionViewItem& option, const QModelIndex& index) const;

	//! Sets the row height. Set this to 0 and the standard will be taken
	void setRowHeight(int height = 0, bool add_to_standard = false);

	//! Renders the delegate using the given painter and style option for the item specified by index.
	virtual void paint (QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const;

protected:
	int RowHeight;
	bool AddRowHeight;


};

}

#endif // QPROPERTYDELEGATE_H
